package com.base.cn.platform.os.service.course.classes.topic.like;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.course.CourseBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 班级话题点赞
 *
 * @author SK
 * @since 2018-05-30
 */
@FeignClient(value = CourseBaseService.appName, configuration = FeignAuthConfig.class)
public interface ClassesTopicLikeService extends CourseBaseService {

    /**
     * 查询班级话题点赞列表
     *
     * @param like    话题点赞查询条件
     * @param count   查询数量
     * @param setUser 设置用户
     * @return 班级话题点赞列表
     */
    @RequestMapping(contextPath + "/findClassesTopicLikeList")
    List<Map<String, Object>> findClassesTopicLikeList(@RequestBody Map<String, Object> like,
                                                       @RequestParam(value = "count", required = false) Integer count,
                                                       @RequestParam("setUser") boolean setUser);

    /**
     * 保存班级话题点赞
     *
     * @param topicId 话题id
     * @param userId  用户id
     * @return 保存结果
     */
    @RequestMapping(contextPath + "/saveClassesTopicLike")
    Map<String, Object> saveClassesTopicLike(@RequestParam("topicId") BigDecimal topicId,
                                             @RequestParam("userId") BigDecimal userId);

    /**
     * 验证用户是点赞过话题
     * @param userId 用户ID
     * @param topicId 话题 ID
     * @return false未点赞，true已点赞
     */
    @RequestMapping(contextPath + "/checkUserLikeTopic")
    boolean checkUserLikeTopic(@RequestParam("userId") BigDecimal userId,
                               @RequestParam("topicId") BigDecimal topicId);
}
